﻿namespace MSRI.HelperClasses
{
    using System;

    [Serializable]
    public class SmsClass
    {
        private string _Body;
        private string _clientName;
        private Guid _MessageID;
        private string _Number;
        private DateTime _Time;

        public SmsClass()
        {
            this._Number = "";
            this._Body = "";
            this._Time = DateTime.Now;
            this._MessageID = Guid.NewGuid();
            this._clientName = null;
        }

        public SmsClass(SmsClass SmsMessage)
        {
            this._Number = SmsMessage.Number;
            this._Body = SmsMessage.Body;
            this._Time = SmsMessage.Time;
            this._MessageID = SmsMessage.MessageID;
            this._clientName = SmsMessage.ClientName;
        }

        public SmsClass(string[] Fields)
        {
            this._Number = Fields[1];
            this._Body = Fields[2];
            this._Time = new DateTime(Convert.ToInt64(Fields[3]));
            this._MessageID = new Guid(Fields[4]);
        }

        public SmsClass(string MobileNumber, string SmsBody)
        {
            this._Number = MobileNumber;
            this._Body = SmsBody;
            this._MessageID = Guid.NewGuid();
            this._Time = DateTime.Now;
            this._clientName = null;
        }

        public int Sizeof()
        {
            int num = 0;
            num += this._Number.ToString().Length + 1;
            num += this._Body.Length + 1;
            num += this._Time.ToString().Length + 1;
            return (num + (this._MessageID.ToString().Length + 1));
        }

        public override string ToString()
        {
            object[] objArray = new object[] { 0.ToString(), Convert.ToChar(Delim.Field), this._Number.ToString(), Convert.ToChar(Delim.Field), this._Body.ToString(), Convert.ToChar(Delim.Field), this._Time.Ticks.ToString(), Convert.ToChar(Delim.Field), this._MessageID.ToString() };
            return string.Concat(objArray);
        }

        public string Body
        {
            get
            {
                return this._Body;
            }
            set
            {
                this._Body = value;
            }
        }

        public string ClientName
        {
            get
            {
                return this._clientName;
            }
            set
            {
                this._clientName = value;
            }
        }

        public Guid MessageID
        {
            get
            {
                return this._MessageID;
            }
            set
            {
                this._MessageID = value;
            }
        }

        public string Number
        {
            get
            {
                return this._Number;
            }
            set
            {
                this._Number = value;
            }
        }

        public DateTime Time
        {
            get
            {
                return this._Time;
            }
            set
            {
                this._Time = value;
            }
        }
    }
}

